package panel

type Scrollable interface {
    FillIn(canSee, outOf, startingAt int)
}

type ScrollablePanel struct {
    Common
}

func (s *ScrollablePanel) Refresh() {
	Log("Scrollable.Refresh")
    s.FillIn(1, 1, 0)
}

func (s *ScrollablePanel) FillIn(canSee, outOf int, startingAt int) {
/*
    if outOf == 0 { outOf = 1 }
    if canSee > outOf { canSee = outOf }
    if startingAt > outOf { startingAt = outOf }
    lines := s.Lines
//
    for i := 0; i < lines; i += 1 { s.Put(i, 0, '*') }
//
    // RESTORE s.Put(0, 0, curses.ACS_VLINE)
    // RESTORE s.Put(1, 0, curses.ACS_BTEE)
//
    free := lines - 6
    linesToShow := canSee * free / outOf + 1
    start := 2 + startingAt * (free - linesToShow) / outOf
    end := start + linesToShow
    
    _ = end
//
//     log("                                                               ")
//     log("canSee ", canSee, " out of ", outOf, " lines.")
//     log("starting at ", startingAt)
//     log("lines = ", lines, ", linesToShow = ", linesToShow)
//     log("start = ", start, ", end = ", end)
//
    for i := 2; i < start; i += 1 { s.Put(i, 0, ' ') }
//
    // RESTORE s.Put(start, 0, curses.ACS_TTEE)
    // RESTORE for i := start + 1; i < end; i += 1 { s.Put(i, 0, curses.ACS_VLINE) }
    // RESTORE s.Put(end, 0, curses.ACS_BTEE)
    // RESTORE for i := end + 1; i < lines - 2; i += 1 { s.Put(i, 0, ' ') }
//
    // RESTORE s.Put(lines-2, 0, curses.ACS_TTEE)
    // RESTORE s.Put(lines-1, 0, curses.ACS_VLINE)
*/
}
